
\parskip=20pt
\parindent=0pt

\long\def\TEST[#1]{%
\begingroup
\pgfplotsset{
	xmin=-1,
	xmax=10,
	ymin=-1,
	ymax=5,
	legend entries={x},
	legend pos=outer north east,
	%/pgfplots/compat/BB/pre 1.3,
	xlabel=$x$,
	ylabel=$y$,
	every axis/.style={
		at={(1cm,1cm)},
	},
	xlabel style={name=Xlabel},
}%
\def\PLOTS{%
	\addplot coordinates {(-1,-1) (1,1)};
	%
	%\node[fill=red,inner sep=1pt,name=INNER] (4,2) {.};
}%
\def\AFTERAXIS{%
	\foreach \A in {%
		south west,%
		north east,%
		right of north east,%
		outer north east,%
		origin}
	{
		\node[at={(current axis.\A)},pin={\tiny\A},fill=black,circle,inner sep=1pt] {};
	};
	%
	%\node[at={(INNER)}] {X};
	%
	\coordinate[at={(Xlabel)},pin=Xlabel] {};
}%

\begin{tikzpicture}[baseline]

	\draw[-stealth,red] (-1,-1) -- (0,0);

	\begin{axis}[
		#1,
		cell picture=true,
	]
	\PLOTS
	\end{axis}
	\AFTERAXIS
\end{tikzpicture}

\begin{tikzpicture}[baseline]

	\draw[-stealth,red] (-1,-1) -- (0,0);

%\tracingcommands=2\tracingmacros=2
	\begin{axis}[
		#1,
		cell picture=false,
	]
	\PLOTS
	\end{axis}
	\AFTERAXIS
\end{tikzpicture}
\endgroup
}
